// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

pub mod app_connections_service {
    use crate::Result;

    /// A builder for [AppConnectionsService][crate::client::AppConnectionsService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_beyondcorp_appconnections_v1::*;
    /// # use builder::app_connections_service::ClientBuilder;
    /// # use client::AppConnectionsService;
    /// let builder : ClientBuilder = AppConnectionsService::builder();
    /// let client = builder
    ///     .with_endpoint("https://beyondcorp.googleapis.com")
    ///     .build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub type ClientBuilder =
        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;

    pub(crate) mod client {
        use super::super::super::client::AppConnectionsService;
        pub struct Factory;
        impl gax::client_builder::internal::ClientFactory for Factory {
            type Client = AppConnectionsService;
            type Credentials = gaxi::options::Credentials;
            async fn build(
                self,
                config: gaxi::options::ClientConfig,
            ) -> gax::client_builder::Result<Self::Client> {
                Self::Client::new(config).await
            }
        }
    }

    /// Common implementation for [crate::client::AppConnectionsService] request builders.
    #[derive(Clone, Debug)]
    pub(crate) struct RequestBuilder<R: std::default::Default> {
        stub: std::sync::Arc<dyn super::super::stub::dynamic::AppConnectionsService>,
        request: R,
        options: gax::options::RequestOptions,
    }

    impl<R> RequestBuilder<R>
    where
        R: std::default::Default,
    {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::AppConnectionsService>,
        ) -> Self {
            Self {
                stub,
                request: R::default(),
                options: gax::options::RequestOptions::default(),
            }
        }
    }

    /// The request builder for [AppConnectionsService::list_app_connections][crate::client::AppConnectionsService::list_app_connections] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_beyondcorp_appconnections_v1::builder;
    /// use builder::app_connections_service::ListAppConnections;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ListAppConnections {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ListAppConnections(RequestBuilder<crate::model::ListAppConnectionsRequest>);

    impl ListAppConnections {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::AppConnectionsService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ListAppConnectionsRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ListAppConnectionsResponse> {
            (*self.0.stub)
                .list_app_connections(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<crate::model::ListAppConnectionsResponse, gax::error::Error>
        {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<
            crate::model::ListAppConnectionsResponse,
            gax::error::Error,
        > {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        /// Sets the value of [parent][crate::model::ListAppConnectionsRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [page_size][crate::model::ListAppConnectionsRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [page_token][crate::model::ListAppConnectionsRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }

        /// Sets the value of [filter][crate::model::ListAppConnectionsRequest::filter].
        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.filter = v.into();
            self
        }

        /// Sets the value of [order_by][crate::model::ListAppConnectionsRequest::order_by].
        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.order_by = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ListAppConnections {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [AppConnectionsService::get_app_connection][crate::client::AppConnectionsService::get_app_connection] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_beyondcorp_appconnections_v1::builder;
    /// use builder::app_connections_service::GetAppConnection;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetAppConnection {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetAppConnection(RequestBuilder<crate::model::GetAppConnectionRequest>);

    impl GetAppConnection {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::AppConnectionsService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetAppConnectionRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::AppConnection> {
            (*self.0.stub)
                .get_app_connection(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::GetAppConnectionRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetAppConnection {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [AppConnectionsService::create_app_connection][crate::client::AppConnectionsService::create_app_connection] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_beyondcorp_appconnections_v1::builder;
    /// use builder::app_connections_service::CreateAppConnection;
    /// # tokio_test::block_on(async {
    /// use lro::Poller;
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.poller().until_done().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> CreateAppConnection {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct CreateAppConnection(RequestBuilder<crate::model::CreateAppConnectionRequest>);

    impl CreateAppConnection {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::AppConnectionsService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::CreateAppConnectionRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        ///
        /// # Long running operations
        ///
        /// This starts, but does not poll, a longrunning operation. More information
        /// on [create_app_connection][crate::client::AppConnectionsService::create_app_connection].
        pub async fn send(self) -> Result<longrunning::model::Operation> {
            (*self.0.stub)
                .create_app_connection(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Creates a [Poller][lro::Poller] to work with `create_app_connection`.
        pub fn poller(
            self,
        ) -> impl lro::Poller<crate::model::AppConnection, crate::model::AppConnectionOperationMetadata>
        {
            type Operation = lro::internal::Operation<
                crate::model::AppConnection,
                crate::model::AppConnectionOperationMetadata,
            >;
            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);

            let stub = self.0.stub.clone();
            let mut options = self.0.options.clone();
            options.set_retry_policy(gax::retry_policy::NeverRetry);
            let query = move |name| {
                let stub = stub.clone();
                let options = options.clone();
                async {
                    let op = GetOperation::new(stub)
                        .set_name(name)
                        .with_options(options)
                        .send()
                        .await?;
                    Ok(Operation::new(op))
                }
            };

            let start = move || async {
                let op = self.send().await?;
                Ok(Operation::new(op))
            };

            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
        }

        /// Sets the value of [parent][crate::model::CreateAppConnectionRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [app_connection_id][crate::model::CreateAppConnectionRequest::app_connection_id].
        pub fn set_app_connection_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.app_connection_id = v.into();
            self
        }

        /// Sets the value of [app_connection][crate::model::CreateAppConnectionRequest::app_connection].
        ///
        /// This is a **required** field for requests.
        pub fn set_app_connection<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::AppConnection>,
        {
            self.0.request.app_connection = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [app_connection][crate::model::CreateAppConnectionRequest::app_connection].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_app_connection<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::AppConnection>,
        {
            self.0.request.app_connection = v.map(|x| x.into());
            self
        }

        /// Sets the value of [request_id][crate::model::CreateAppConnectionRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }

        /// Sets the value of [validate_only][crate::model::CreateAppConnectionRequest::validate_only].
        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
            self.0.request.validate_only = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for CreateAppConnection {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [AppConnectionsService::update_app_connection][crate::client::AppConnectionsService::update_app_connection] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_beyondcorp_appconnections_v1::builder;
    /// use builder::app_connections_service::UpdateAppConnection;
    /// # tokio_test::block_on(async {
    /// use lro::Poller;
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.poller().until_done().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> UpdateAppConnection {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct UpdateAppConnection(RequestBuilder<crate::model::UpdateAppConnectionRequest>);

    impl UpdateAppConnection {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::AppConnectionsService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::UpdateAppConnectionRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        ///
        /// # Long running operations
        ///
        /// This starts, but does not poll, a longrunning operation. More information
        /// on [update_app_connection][crate::client::AppConnectionsService::update_app_connection].
        pub async fn send(self) -> Result<longrunning::model::Operation> {
            (*self.0.stub)
                .update_app_connection(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Creates a [Poller][lro::Poller] to work with `update_app_connection`.
        pub fn poller(
            self,
        ) -> impl lro::Poller<crate::model::AppConnection, crate::model::AppConnectionOperationMetadata>
        {
            type Operation = lro::internal::Operation<
                crate::model::AppConnection,
                crate::model::AppConnectionOperationMetadata,
            >;
            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);

            let stub = self.0.stub.clone();
            let mut options = self.0.options.clone();
            options.set_retry_policy(gax::retry_policy::NeverRetry);
            let query = move |name| {
                let stub = stub.clone();
                let options = options.clone();
                async {
                    let op = GetOperation::new(stub)
                        .set_name(name)
                        .with_options(options)
                        .send()
                        .await?;
                    Ok(Operation::new(op))
                }
            };

            let start = move || async {
                let op = self.send().await?;
                Ok(Operation::new(op))
            };

            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
        }

        /// Sets the value of [update_mask][crate::model::UpdateAppConnectionRequest::update_mask].
        ///
        /// This is a **required** field for requests.
        pub fn set_update_mask<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [update_mask][crate::model::UpdateAppConnectionRequest::update_mask].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = v.map(|x| x.into());
            self
        }

        /// Sets the value of [app_connection][crate::model::UpdateAppConnectionRequest::app_connection].
        ///
        /// This is a **required** field for requests.
        pub fn set_app_connection<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<crate::model::AppConnection>,
        {
            self.0.request.app_connection = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [app_connection][crate::model::UpdateAppConnectionRequest::app_connection].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_app_connection<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<crate::model::AppConnection>,
        {
            self.0.request.app_connection = v.map(|x| x.into());
            self
        }

        /// Sets the value of [request_id][crate::model::UpdateAppConnectionRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }

        /// Sets the value of [validate_only][crate::model::UpdateAppConnectionRequest::validate_only].
        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
            self.0.request.validate_only = v.into();
            self
        }

        /// Sets the value of [allow_missing][crate::model::UpdateAppConnectionRequest::allow_missing].
        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
            self.0.request.allow_missing = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for UpdateAppConnection {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [AppConnectionsService::delete_app_connection][crate::client::AppConnectionsService::delete_app_connection] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_beyondcorp_appconnections_v1::builder;
    /// use builder::app_connections_service::DeleteAppConnection;
    /// # tokio_test::block_on(async {
    /// use lro::Poller;
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.poller().until_done().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> DeleteAppConnection {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct DeleteAppConnection(RequestBuilder<crate::model::DeleteAppConnectionRequest>);

    impl DeleteAppConnection {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::AppConnectionsService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::DeleteAppConnectionRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        ///
        /// # Long running operations
        ///
        /// This starts, but does not poll, a longrunning operation. More information
        /// on [delete_app_connection][crate::client::AppConnectionsService::delete_app_connection].
        pub async fn send(self) -> Result<longrunning::model::Operation> {
            (*self.0.stub)
                .delete_app_connection(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Creates a [Poller][lro::Poller] to work with `delete_app_connection`.
        pub fn poller(self) -> impl lro::Poller<(), crate::model::AppConnectionOperationMetadata> {
            type Operation =
                lro::internal::Operation<wkt::Empty, crate::model::AppConnectionOperationMetadata>;
            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);

            let stub = self.0.stub.clone();
            let mut options = self.0.options.clone();
            options.set_retry_policy(gax::retry_policy::NeverRetry);
            let query = move |name| {
                let stub = stub.clone();
                let options = options.clone();
                async {
                    let op = GetOperation::new(stub)
                        .set_name(name)
                        .with_options(options)
                        .send()
                        .await?;
                    Ok(Operation::new(op))
                }
            };

            let start = move || async {
                let op = self.send().await?;
                Ok(Operation::new(op))
            };

            lro::internal::new_unit_response_poller(
                polling_error_policy,
                polling_backoff_policy,
                start,
                query,
            )
        }

        /// Sets the value of [name][crate::model::DeleteAppConnectionRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }

        /// Sets the value of [request_id][crate::model::DeleteAppConnectionRequest::request_id].
        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.request_id = v.into();
            self
        }

        /// Sets the value of [validate_only][crate::model::DeleteAppConnectionRequest::validate_only].
        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
            self.0.request.validate_only = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for DeleteAppConnection {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [AppConnectionsService::resolve_app_connections][crate::client::AppConnectionsService::resolve_app_connections] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_beyondcorp_appconnections_v1::builder;
    /// use builder::app_connections_service::ResolveAppConnections;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ResolveAppConnections {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ResolveAppConnections(RequestBuilder<crate::model::ResolveAppConnectionsRequest>);

    impl ResolveAppConnections {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::AppConnectionsService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ResolveAppConnectionsRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ResolveAppConnectionsResponse> {
            (*self.0.stub)
                .resolve_app_connections(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<crate::model::ResolveAppConnectionsResponse, gax::error::Error>
        {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<
            crate::model::ResolveAppConnectionsResponse,
            gax::error::Error,
        > {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        /// Sets the value of [parent][crate::model::ResolveAppConnectionsRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [app_connector_id][crate::model::ResolveAppConnectionsRequest::app_connector_id].
        ///
        /// This is a **required** field for requests.
        pub fn set_app_connector_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.app_connector_id = v.into();
            self
        }

        /// Sets the value of [page_size][crate::model::ResolveAppConnectionsRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [page_token][crate::model::ResolveAppConnectionsRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ResolveAppConnections {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [AppConnectionsService::list_locations][crate::client::AppConnectionsService::list_locations] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_beyondcorp_appconnections_v1::builder;
    /// use builder::app_connections_service::ListLocations;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ListLocations {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);

    impl ListLocations {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::AppConnectionsService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
            (*self.0.stub)
                .list_locations(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
        {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
        {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        /// Sets the value of [name][location::model::ListLocationsRequest::name].
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }

        /// Sets the value of [filter][location::model::ListLocationsRequest::filter].
        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.filter = v.into();
            self
        }

        /// Sets the value of [page_size][location::model::ListLocationsRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [page_token][location::model::ListLocationsRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ListLocations {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [AppConnectionsService::get_location][crate::client::AppConnectionsService::get_location] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_beyondcorp_appconnections_v1::builder;
    /// use builder::app_connections_service::GetLocation;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetLocation {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);

    impl GetLocation {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::AppConnectionsService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<location::model::Location> {
            (*self.0.stub)
                .get_location(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][location::model::GetLocationRequest::name].
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetLocation {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [AppConnectionsService::set_iam_policy][crate::client::AppConnectionsService::set_iam_policy] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_beyondcorp_appconnections_v1::builder;
    /// use builder::app_connections_service::SetIamPolicy;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> SetIamPolicy {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);

    impl SetIamPolicy {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::AppConnectionsService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<iam_v1::model::Policy> {
            (*self.0.stub)
                .set_iam_policy(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
        ///
        /// This is a **required** field for requests.
        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.resource = v.into();
            self
        }

        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
        ///
        /// This is a **required** field for requests.
        pub fn set_policy<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<iam_v1::model::Policy>,
        {
            self.0.request.policy = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<iam_v1::model::Policy>,
        {
            self.0.request.policy = v.map(|x| x.into());
            self
        }

        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
        pub fn set_update_mask<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = v.map(|x| x.into());
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for SetIamPolicy {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [AppConnectionsService::get_iam_policy][crate::client::AppConnectionsService::get_iam_policy] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_beyondcorp_appconnections_v1::builder;
    /// use builder::app_connections_service::GetIamPolicy;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetIamPolicy {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);

    impl GetIamPolicy {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::AppConnectionsService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<iam_v1::model::Policy> {
            (*self.0.stub)
                .get_iam_policy(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
        ///
        /// This is a **required** field for requests.
        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.resource = v.into();
            self
        }

        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
        pub fn set_options<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
        {
            self.0.request.options = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
        {
            self.0.request.options = v.map(|x| x.into());
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetIamPolicy {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [AppConnectionsService::test_iam_permissions][crate::client::AppConnectionsService::test_iam_permissions] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_beyondcorp_appconnections_v1::builder;
    /// use builder::app_connections_service::TestIamPermissions;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> TestIamPermissions {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);

    impl TestIamPermissions {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::AppConnectionsService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
            (*self.0.stub)
                .test_iam_permissions(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
        ///
        /// This is a **required** field for requests.
        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.resource = v.into();
            self
        }

        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
        ///
        /// This is a **required** field for requests.
        pub fn set_permissions<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for TestIamPermissions {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [AppConnectionsService::list_operations][crate::client::AppConnectionsService::list_operations] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_beyondcorp_appconnections_v1::builder;
    /// use builder::app_connections_service::ListOperations;
    /// # tokio_test::block_on(async {
    /// use gax::paginator::ItemPaginator;
    ///
    /// let builder = prepare_request_builder();
    /// let mut items = builder.by_item();
    /// while let Some(result) = items.next().await {
    ///   let item = result?;
    /// }
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ListOperations {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);

    impl ListOperations {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::AppConnectionsService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
            (*self.0.stub)
                .list_operations(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Streams each page in the collection.
        pub fn by_page(
            self,
        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
        {
            use std::clone::Clone;
            let token = self.0.request.page_token.clone();
            let execute = move |token: String| {
                let mut builder = self.clone();
                builder.0.request = builder.0.request.set_page_token(token);
                builder.send()
            };
            gax::paginator::internal::new_paginator(token, execute)
        }

        /// Streams each item in the collection.
        pub fn by_item(
            self,
        ) -> impl gax::paginator::ItemPaginator<
            longrunning::model::ListOperationsResponse,
            gax::error::Error,
        > {
            use gax::paginator::Paginator;
            self.by_page().items()
        }

        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }

        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.filter = v.into();
            self
        }

        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
            self.0.request.page_size = v.into();
            self
        }

        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.page_token = v.into();
            self
        }

        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
            self.0.request.return_partial_success = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ListOperations {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [AppConnectionsService::get_operation][crate::client::AppConnectionsService::get_operation] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_beyondcorp_appconnections_v1::builder;
    /// use builder::app_connections_service::GetOperation;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetOperation {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);

    impl GetOperation {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::AppConnectionsService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<longrunning::model::Operation> {
            (*self.0.stub)
                .get_operation(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetOperation {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [AppConnectionsService::delete_operation][crate::client::AppConnectionsService::delete_operation] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_beyondcorp_appconnections_v1::builder;
    /// use builder::app_connections_service::DeleteOperation;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> DeleteOperation {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);

    impl DeleteOperation {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::AppConnectionsService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<()> {
            (*self.0.stub)
                .delete_operation(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for DeleteOperation {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [AppConnectionsService::cancel_operation][crate::client::AppConnectionsService::cancel_operation] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_beyondcorp_appconnections_v1::builder;
    /// use builder::app_connections_service::CancelOperation;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> CancelOperation {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);

    impl CancelOperation {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::AppConnectionsService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<()> {
            (*self.0.stub)
                .cancel_operation(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for CancelOperation {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }
}
